<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数中的this</title>
</head>
<body>
<script>
   var name = "张三"
   function test (a,b) {
     alert(this.name + "_" + a + "_" + b)
   }
  // test() // window.test() 张三
  var obj = {
    name: "李四"
  }
 // test.call(obj, 1, 2) // 改变this指向并执行这个函数
 // test.apply(obj, [1,2]) // 改变this指向并执行这个函数
 const func = test.bind(obj)
 func()
</script>
</body>
</html>